package test.ground.cotroller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @Author wangshaopeng
 * @Date 2021/2/28
 */
@RequestMapping("/log")
@Component
public class LogController {

    private static final Logger log = LoggerFactory.getLogger(LogController.class);

    @Value("${server.port}")
    private String xx;

    public static final ThreadLocal<String> LOGIN_ID = new ThreadLocal<>();

    @Autowired
    private CommonController commonController;

    @RequestMapping("/l")
    public void log(List<String> xx){
        System.out.println("当前登录："+LOGIN_ID.get());
        log.debug("debug");
        log.info("info");
        log.warn("warn");
        log.error("error");
        log1(xx);
        commonController.d2(1, null);
    }


    public void log1(Object xx){
        System.out.println("log1");
    }

    public void log2(Runnable runnable){
        runnable.run();
    }

    public Integer log3(String id){
        return Integer.valueOf(id);
    }

}
